/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO

Authors: Nitay Megides
		 Rachel Banino

Project: Exercise 2

Using:	LinkedList.h
		General.h

Description:
The main entry point for the application.
oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#include <Windows.h>
#include <tchar.h>
#include "TextFileReader.h"
#include "StringConversionTools.h"
#include <stdio.h>
#include "TestManager.h"
#include "General.h"


int _tmain(int argc, _TCHAR* argv[])
{
	TCHAR* exeFilename = TEXT("");
	TCHAR* testsFileFilename = TEXT("");
	TCHAR* correctnessLogFilename = TEXT("");
	TCHAR* timeoutLogFilename = TEXT("");
	int correctStatusCode = 0;
	
	if (argc < 5)
	{
		printf("Not enough parameters");
		return 0;
	}

	// Get the program parameters
	exeFilename = argv[1];
	testsFileFilename = argv[2];
	correctnessLogFilename = argv[3];
	timeoutLogFilename = argv[4];

	if (argc > 5)
		correctStatusCode = _ttoi(argv[5]);

    if (InitializeTestManager(correctStatusCode))
	{
		if (LoadTests(testsFileFilename, exeFilename))
		{
			if (RunTests())
			{
				ReportResult(correctnessLogFilename, timeoutLogFilename);
			}
		}
        else
        {
            ReportLoadError();
        }
	}

	FreeTestManager();

    // This is nice when debugging. Should be commented out in the release
    //getchar();

	return 0;
}